home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / XML Utilities / Professional Programmer XSL IDE / Xselerator25.msi / Data.Cab / F34428_dvcfoldl.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2001-11-28  |  2.0 KB  |  49 lines

  1. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  2.     <xsl:template name="dvc-foldl">
  3.       <xsl:param name="pFunc" select="/.."/>
  4.       <xsl:param name="pA0"/>
  5.       <xsl:param name="pList" select="/.."/>
  6.  
  7.       <xsl:choose>
  8.          <xsl:when test="not($pList)">
  9.             <xsl:copy-of select="$pA0"/>
  10.          </xsl:when>
  11.          <xsl:otherwise>
  12.             <xsl:variable name="vcntList" select="count($pList)"/>
  13.             <xsl:choose>
  14.               <xsl:when test="$vcntList = 1">
  15.                   <xsl:apply-templates select="$pFunc[1]">
  16.                     <xsl:with-param name="arg0" select="$pFunc[position() > 1]"/>
  17.                     <xsl:with-param name="arg1" select="$pA0"/>
  18.                     <xsl:with-param name="arg2" select="$pList[1]"/>
  19.                   </xsl:apply-templates>
  20.               </xsl:when>
  21.               <xsl:otherwise>
  22.                 <xsl:variable name="vHalfLen"
  23.                               select="floor($vcntList div 2)"/>
  24.                 <xsl:variable name="vFunResult1">
  25.                   <xsl:call-template name="dvc-foldl">
  26.                     <xsl:with-param name="pFunc" select="$pFunc"/>
  27.                     <xsl:with-param name="pA0" select="$pA0"/>
  28.                     <xsl:with-param name="pList"
  29.                                     select="$pList[position()
  30.                                                  <=
  31.                                                    $vHalfLen
  32.                                                    ]"/>
  33.                   </xsl:call-template>
  34.                 </xsl:variable>
  35.  
  36.                 <xsl:call-template name="dvc-foldl">
  37.                     <xsl:with-param name="pFunc" select="$pFunc"/>
  38.                     <xsl:with-param name="pList" select="$pList[position() > $vHalfLen]"/>
  39.                     <xsl:with-param name="pA0" select="$vFunResult1"/>
  40.  
  41.                 </xsl:call-template>
  42.               </xsl:otherwise>
  43.             </xsl:choose>
  44.          </xsl:otherwise>
  45.       </xsl:choose>
  46.  
  47.     </xsl:template>
  48.  
  49. </xsl:stylesheet>